package testing;

import static org.junit.Assert.*;
import hypeerweb.HyPeerWeb;
import hypeerweb.Node;

import org.junit.Test;

import visitor.*;

public class BroadcastTestVisitorTest {

	@Test
	public void test() {
		HyPeerWeb hypeerweb = HyPeerWeb.getSingleton();
		
		for(int i = 0; i <= 32; i++) {
			createHyPeerWebWith(hypeerweb, i);
			Node node = hypeerweb.getNode(0);
			Visitor broadcast = new BroadcastTestVisitor();
			Parameters p = new Parameters();
			broadcast.visit(node, p);
			System.out.println();
		}
		
		assertTrue(true);
	}
	
	static private void createHyPeerWebWith(HyPeerWeb hypeerweb, int numberOfNodes) {
        hypeerweb.clear();
        Node node0 = new Node(0);
        hypeerweb.addToHyPeerWeb(node0, null);

        for (int i = 1; i < numberOfNodes; i++) {
            Node node = new Node(0);
            node0.addToHyPeerWeb(node);
        }
    }
}
